package com.hzlj.position.job.notice;

import com.fz.common.redis.annotation.SyncLock;
import com.hzlj.position.job.service.NoticeJobService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class NoticeScheduleJob {
    @Resource
    private NoticeJobService noticeJobService;

    @SyncLock(lockMs = 60000)
    @Scheduled(cron = "0 0/5 * * * ?")
    public void schedule() {
        long start = System.currentTimeMillis();
        log.info("任务开始执行[统计报表]");
        noticeJobService.schedule();
        log.info("任务结束执行[统计报表],cost={}", System.currentTimeMillis() - start);
    }
}
